home *** CD-ROM | disk | FTP | other *** search
/ Programming Languages Suite / ProgramD2.iso / Borland / Borland C++ V5.02 / OWLINC.PAK / CHOOSEFO.H < prev    next >
C/C++ Source or Header  |  1997-05-06  |  3KB  |  141 lines

  1. //----------------------------------------------------------------------------
  2. // ObjectWindows
  3. // Copyright (c) 1992, 1997 by Borland International, All Rights Reserved
  4. //
  5. //$Revision:   10.5  $
  6. //
  7. // Definition of Choose Font Common Dialog class
  8. //----------------------------------------------------------------------------
  9. #if !defined(OWL_CHOOSEFO_H)
  10. #define OWL_CHOOSEFO_H
  11.  
  12. #if !defined(OWL_COMMDIAL_H)
  13. # include <owl/commdial.h>
  14. #endif
  15.  
  16. #if defined(BI_NAMESPACE)
  17. namespace ClassLib {
  18. #endif
  19.  
  20. class _WSYSCLASS TColor;
  21.  
  22. #if defined(BI_NAMESPACE)
  23. } // namespace ClassLib
  24. #endif
  25.   
  26.  
  27. #if defined(BI_NAMESPACE)
  28. namespace OWL {
  29. #endif
  30.  
  31. // Generic definitions/compiler options (eg. alignment) preceeding the 
  32. // definition of classes
  33. #include <services/preclass.h>
  34.  
  35. //
  36. // class TChooseFontDialog
  37. // ~~~~~ ~~~~~~~~~~~~~~~~~
  38. // Encapsulates the Choose-Font common dialog.
  39. //
  40. class _OWLCLASS TChooseFontDialog : public TCommonDialog {
  41.   public:
  42.     class _OWLCLASS TData {
  43.       public:
  44.         uint32       Flags;
  45.         uint32       Error;
  46.         HDC          DC;
  47.         LOGFONT      LogFont;
  48.         int          PointSize;
  49.         TColor       Color;
  50.         char far*    Style;
  51.         uint16       FontType;
  52.         int          SizeMin;
  53.         int          SizeMax;
  54.     };
  55.  
  56.     TChooseFontDialog(TWindow*        parent,
  57.                       TData&          data,
  58.                       TResId          templateId = 0,
  59.                       const char far* title = 0,
  60.                       TModule*        module = 0);
  61.    ~TChooseFontDialog();
  62.  
  63.   protected:
  64.     TData&  GetData();
  65.     void    SetData(TData& data);
  66.  
  67.     CHOOSEFONT&   GetCF();
  68.     void    SetCF(const CHOOSEFONT& cf);
  69.  
  70.     int     DoExecute();
  71.     bool    DialogFunction(uint message, TParam1, TParam2);
  72.  
  73.     // Default behavior inline for message response functions
  74.     //
  75.     void    CmFontApply();   // EV_COMMAND(psh3...
  76.  
  77.   protected_data:
  78.     union {
  79.       CHOOSEFONT Cf;  // New name
  80.       CHOOSEFONT cf;  // old name
  81.     };
  82.     TData&       Data;
  83.  
  84.   private:
  85.     TChooseFontDialog(const TChooseFontDialog&);
  86.     TChooseFontDialog& operator=(const TChooseFontDialog&);
  87.  
  88.   DECLARE_RESPONSE_TABLE(TChooseFontDialog);
  89.   DECLARE_CASTABLE;
  90. };
  91.  
  92. // Generic definitions/compiler options (eg. alignment) following the 
  93. // definition of classes
  94. #include <services/posclass.h>
  95.  
  96. #if defined(BI_NAMESPACE)
  97. } // namespace OWL
  98. #endif
  99.  
  100. //----------------------------------------------------------------------------
  101. // Inline implementations
  102. //
  103.  
  104. //
  105. // Return the data associated with this dialog.
  106. //
  107. inline TChooseFontDialog::TData& TChooseFontDialog::GetData() {
  108.   return Data;
  109. }
  110.  
  111. //
  112. // Set the data associated with this dialog.
  113. // Use this function with caution!
  114. //
  115. inline void TChooseFontDialog::SetData(TData& data) {
  116.   Data = data;
  117. }
  118.  
  119. //
  120. // Return the CHOOSEFONT data structure for this dialog.
  121. //
  122. inline CHOOSEFONT& TChooseFontDialog::GetCF() {
  123.   return Cf;
  124. }
  125.  
  126. //
  127. // Set the CHOOSEFONT data structure for this dialog.
  128. //
  129. inline void TChooseFontDialog::SetCF(const CHOOSEFONT& cf) {
  130.   Cf = cf;
  131. }
  132.  
  133. //
  134. // User clicked on Apply for the font.
  135. //
  136. inline void TChooseFontDialog::CmFontApply() {
  137.   DefaultProcessing();
  138. }
  139.  
  140. #endif  // OWL_CHOOSEFO_H
  141.